<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>管理系统平台</title>
<meta name="keywords" content="管理系统平台" />
<meta name="description" content="LarryCMS Version:1.09" />
<meta name="Author" content="larry" />
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">

<link href="${pageContext.request.contextPath}/business/images/icon.png" rel="shortcut icon" />
<!-- load css -->
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/business/ui/common/layui/css/layui.css" media="all">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/business/ui/common/css/global.css" media="all">
<script type="text/javascript" src="${pageContext.request.contextPath}/business/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/business/ui/common/css/font_bmgv5kod196q1tt9.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/business/ui/backstage/css/backstage.css" media="all">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

 <script>
 
</script>  
</head>
<body>
	<div class="layui-layout layui-layout-admin" id="layui_layout">
		<!-- 顶部区域 -->
		<div class="layui-header header-menu">
			<div class="logo posb" id="log">
				<img src="${pageContext.request.contextPath}/business/ui/common/images/logo.png">
			</div>
			<div class="layui-main posb">
				<!-- 左侧导航收缩开关 -->
				<div class="side-menu-switch posb" id="toggle">
					<span class="switch" ara-hidden="true"></span>
				</div>
				<!-- 顶级菜单 -->
				<div class="larry-top-menu posb">
					<ul class="layui-nav clearfix" id="menu">
					</ul>
				</div>
				<!-- 右侧常用菜单导航 -->
				<div class="larry-right-menu posb">
					<!--<button class="layui-btn layui-btn-small" id="dianzhan">-->
					<!--<i class="larry-icon larry-dianzan"></i>-->
					<!--打赏作者-->
					<!--</button>-->
					<ul class="layui-nav clearfix">
						<%-- 	<c:if test="${sessionScope.sysuser!=null}">
						 <li class="layui-nav-item">
						${sessionScope.sysuser.persname}
						</li>
					</c:if> --%>
					<li class="layui-nav-item"><a onclick="addtab('未读消息','${pageContext.request.contextPath}/sys/sysnoticemessage/unreadlist.do','larry-gerenxinxi5')" ><i class="larry-icon larry-duanxin-copy" ></i>系统消息<i id="messageNum"></i><i id="MessagetotalNum"></i></i></a></li>
						<li class="layui-nav-item"><a onclick="changepassword()"><i class="larry-icon larry-xitongshezhi1"></i>修改密码</a></li>
						<li class="layui-nav-item"><a class="onFullScreen" id="FullScreen"><i class="larry-icon larry-quanping"></i>全屏</a></li>
						<!-- <li class="layui-nav-item"><a id="lock"><i class="larry-icon larry-diannao5"></i>锁屏</a></li> -->
						<!-- <li class="layui-nav-item"><a id="clearCached"><i class="larry-icon larry-qingchuhuancun"></i>清除缓存</a></li> -->
					<!-- 	<li class="layui-nav-item"><a id="larryTheme"><i class="larry-icon larry-theme1"></i>设置主题</a></li> -->
						<!--<li class="layui-nav-item kjfs">
                        <a class="kuaijiefangshi"><i class="larry-icon larry-kuaijie"></i><cite>快捷方式</cite></a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="http://www.larrycms.com/" target="_blank">网站主页</a>
                            </dd>
                            <dd>
                                <a href="http://blog.larrycms.com/" target="_blank">我的博客</a>
                            </dd>
                        </dl>
                    </li>-->
						<li class="layui-nav-item exit"><a id="logout"><i class="larry-icon larry-exit"></i><cite>退出</cite></a></li>
					</ul>
				</div>
			</div>
		</div>
		<!-- 左侧导航 -->
		<div class="layui-side larrycms-left" id="larry-side">
			<div class="layui-side-scroll">
				<!-- 管理员信息      -->
				<!--<div class="user-info">
                   <div class="photo">
                       <img src="images/user.jpg" alt="">
                   </div>
                   <p>admin您好！欢迎登录</p>
              </div>-->
				<!-- 系统菜单 -->
				<div class="sys-menu-box">
					<ul class="layui-nav layui-nav-tree" id="larrySideNav" lay-filter="side">

					</ul>
				</div>
			</div>
		</div>
		<!-- 右侧主题内容 -->
		<div class="layui-body" id="larry-body">
			<div class="layui-tab" id="larry-tab" lay-filter="larryTab">
				<div class="larry-title-box">
					<div class="go-left key-press pressKey" id="titleLeft" title="滚动至最右侧">
						<i class="larry-icon larry-weibiaoti6-copy"></i>
					</div>
					<ul class="layui-tab-title" lay-allowClose="true" id="layui-tab-title" lay-filter="subadd">
						<li class="layui-this" id="admin-home" lay-id="0" fresh=1><i class="larry-icon larry-houtaishouye"></i><em>首页</em></li>
					</ul>
					<div class="title-right" id="titleRbox">
						<div class="go-right key-press pressKey" id="titleRight" title="滚动至最左侧">
							<i class="larry-icon larry-right"></i>
						</div>
						<div class="refresh key-press" id="refresh_iframe">
							<i class="larry-icon larry-shuaxin2"></i><cite>刷新</cite>
						</div>
						<div class="often key-press" lay-filter='larryOperate' id="buttonRCtrl">
							<ul class="layui-nav posr">
								<li class="layui-nav-item posb"><a class="top"><i class="larry-icon larry-caozuo"></i><cite>常用操作</cite></a>
									<dl class="layui-nav-child">
										<dd>
											<a data-eName="closeCurrent"><i class="larry-icon larry-guanbidangqianye"></i>关闭当前选项卡</a>
										</dd>
										<dd>
											<a data-eName="closeOther"><i class="larry-icon larry-guanbiqita"></i>关闭其他选项卡</a>
										</dd>
										<dd>
											<a data-eName="closeAll"><i class="larry-icon larry-guanbiquanbufenzu"></i>关闭全部选项卡</a>
										</dd>
										<dd>
											<a data-eName="refreshAdmin"><i class="larry-icon larry-kuangjia_daohang_shuaxin"></i>刷新平台主页面</a>
										</dd>
									</dl></li>
							</ul>
						</div>

					</div>
				</div>
				<div class="layui-tab-content" id="container"> 
					<div class="layui-tab-item layui-show">
						<iframe class="larry-iframe" data-id='0' name="ifr_0" id='ifr0' src="${pageContext.request.contextPath}/main/main"></iframe>
					</div>
				</div>
			</div>
		</div>
		<!-- footer -->
		<!-- <div class="layui-footer layui-larry-foot psob" id="larry-footer">
			<div class="layui-main">
				<p>2017-2018 © 合肥明信软件技术有限公司. 版权所有</p>
			</div>
		</div> -->
		<!-- footer end -->
		<!-- layui-layout-admin end -->
	</div>
	<!-- 加载js文件-->
	<input type="hidden" id="contextPath" name="contextPath" value="${pageContext.request.contextPath}" />
	<script type="text/javascript" src="${pageContext.request.contextPath}/business/ui/common/layui/layui.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/business/ui/backstage/js/larrycms.js"></script>
	<!-- 主题配置 -->
	<div class="larryThemeContent" id="LarryThemeSet" style="display:none;">
		<div class="larry-theme-form">
			<h3>系统主题预设</h3>
			<form action="" class="layui-form larry-theme-con">
				<div class="layui-form-item select-theme">
					<label class="layui-form-label">主题选择</label>
					<div class="layui-input-block">
						<select lay-filter="larryTheme" lay-verify="" id="themeName">
							<option value="larry">LarryCMS默认主题</option>
							<option value="A">LarryCMS深蓝主题</option>
							<option value="B">LarryCMS墨绿主题</option>
							<!-- <option value="larry_">更多主题以后添加</option> -->
						</select>
					</div>
				</div>
				<div class="layui-form-item fullscreen">
					<label class="layui-form-label">是否全屏</label>
					<div class="layui-input-block">
						<input type="checkbox" lay-filter="fullscreen" lay-skin="switch" value="1">
					</div>
				</div>
				<div class="layui-form-item submit-form">
					<button class="layui-btn larry-button" lay-submit="" lay-filter="submitlocal">立即设置主题</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置当前设置</button>
				</div>
			</form>
		</div>
	</div>
	<!-- layui-body常用菜单定义 -->
	<div class="rightMenu" id="rightMenu" style="display: none;">
		<ul>
			<li data-target="refreshCur"><i class="larry-icon "></i>刷新当前页面</li>
			<li data-target="refreshKj"><i class="larry-icon "></i>刷新外层框架</li>
			<li data-target="closeCurrent"><i class="larry-icon "></i>关闭当前选项卡</li>
			<li data-target="closeOther"><i class="larry-icon "></i>关闭其他选项卡</li>
			<li data-target="closeAll"><i class="larry-icon "></i>全部关闭选项卡</li>
		</ul>
	</div>
	<!-- 屏幕锁屏 -->
	<div class="lock-screen" style="display: none;">
		<div class="lock-wrapper" id="lock-screen">
			<div id="time"></div>
			<div class="lock-box">
				<img src="${pageContext.request.contextPath}/business/ui/backstage/images/user.jpg" alt="">
				<h1>admin</h1>
				<form action="" class="layui-form lock-form">
					<div class="layui-form-item">
						<input type="password" name="lock_password" lay-verify="pass" placeholder="锁屏状态，请输入密码解锁" autocomplete="off" class="layui-input" autofocus="">
					</div>
					<div class="layui-form-item">
						<button class="layui-btn larry-btn" id="unlock">立即解锁</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	<input type="hidden" id="contextPath" name="contextPath" value="${pageContext.request.contextPath}">
	<input type="hidden" id="isok" name="isok" value="0">
</body>

 	<script src="${pageContext.request.contextPath}/business/jquery-mxygshop-min.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/business/ui/common/js/jquery.nicescroll.min.js" ></script>
</html>
<script type="text/javascript">
var socket;
$(function(){
	getMessageNum();
	getMessageTotalNum();
	var layer;
	layui.use('layer', function() { //独立版的layer无需执行这一句
	    layer = layui.layer; //独立版的layer无需执行这一句
		/* layer.open({
			  title: '测试websocket推送',
			  offset: 'rb',
			  content: '可以填写任意的消息'
			});   */
	});
	//connect();
});
function connect() {  
	if (typeof (WebSocket) == "undefined"){  
	    alert("This explorer don't support WebSocket")  ;
	    return;
	}  
	//Connect WebSocket server  
	 var host = window.location.host;
	 var contextPath = $("#contextPath").val();
	//var host2 = '192.168.1.121:8080';
	socket =new WebSocket("ws://"+host+contextPath+"/wbSocket");  
	//open  
	socket.onopen = function () {  
		layer.msg("websocket is open ",{icon:1,time:1000});
	};  
	//Get message  
	socket.onmessage = function (event){ 
		layer.open({
			  title: 'websocket消息推送',
			  offset: 'rb',
			  btn:'',
			  content: event.data
			});
	};
	//close  
	socket.onclose = function () {  
	    //alert("WebSocket is closed");  
	};
	//error  
	socket.onerror = function (e){  
	    alert("Error is " + e.data); 
	};  
	}  

	function close() {  
	 socket.close();  
	}  

	function sendMsg() {  
	socket.send("This is a client message ");  
	}   
	//添加选项卡
	function addtab(title, url, icon) {
		layui.use('navtab', function() {
			var navtab = layui.navtab({
				elem : '#larry-tab'
			});
			navtab.tabAdd({
				href : url,
				icon : icon,
				title : title
			});
		});
	}
	//关闭当前选项卡
	function deltab() {
		layui.use('navtab', function() {
			var navtab = layui.navtab({
				elem : '#larry-tab'
			});
			navtab.deleteTab(navtab.getCurrentTabId());
		});

	}
	//根据title切换选项卡
	function tabChange(title) {
		layui.use('navtab', function() {
			var navtab = layui.navtab({
				elem : '#larry-tab'
			});
			navtab.tabChange(title);
		});

	}
	//关闭当前选项卡并刷新指定title选项卡
	function deltabandRefresh(title) {
		deltab();
		tabChange(title);
		refreshiframe();

	}
	function deltabandReturn(title) {
		deltab();
		tabChange(title);
	}
	
	function deltabbyid(id) {
		layui.use('navtab', function() {
			var navtab = layui.navtab({
				elem : '#larry-tab'
			});
			navtab.deleteTab(id);
		});

	}
	//刷新当前选项卡
	function refreshiframe() {
		$(".layui-tab-content .layui-tab-item").each(function() {
			if ($(this).hasClass('layui-show')) {
				$(this).children('iframe')[0].contentWindow.location.reload(true);
			}
		});
	}

	function changePageList() {
		$(".layui-tab-content .layui-tab-item").each(function() {
			$(this).children('iframe')[0].setAttribute("src", "/mxygshopadmin/member/changeMemberListPage.do")
		});
	}

	changepassword = function() {
		var contextPath = $("#contextPath").val();
		$("#isok").val("0");
		var imagesrc = '<img src=' + contextPath + '/business/images/icon/user_edit.png>&nbsp;修改密码';
		layer.open({
			id : "changpass",
			title : imagesrc,
			type : 2,
			closeBtn : 0, // 不显示关闭按钮
			area : [ '500px', '300px' ],
			fix : false, // 不固定
			maxmin : false,
			shade : false,
			content : [ contextPath + '/main/changepass', 'no' ],
			success : function(layero, index) {
			},
			end : function() {
				var isok = $("#isok").val();
				if (parseInt(isok) == 1) {
					alertMsg("修改成功");
					//goBack();
				} else if (parseInt(isok) == 2) {
					alertMsg("修改失败");
				}
			}
		});
	}
	//未读消息
	function getMessageNum() {
	$.ajax({
		type : "post",
		url : $("#contextPath").val() + "/sys/sysnoticemessage/getMessageNum",
		data : {},
		dataType : "json",
		success : function(data) {
			if (data && data.success) {

				$("#messageNum").html("(" + data.obj);
			}
		}
	});
}
	
	//总消息
	function getMessageTotalNum() {
	$.ajax({
		type : "post",
		url : $("#contextPath").val() + "/sys/sysnoticemessage/getMessagetotalNum",
		data : {},
		dataType : "json",
		success : function(data) {
			if (data && data.success) {

				$("#MessagetotalNum").html("/" + data.obj + ")");
			}
		}
	});
}
	
</script>